#pragma once
#include <osg/Node>
#include <osg/PositionAttitudeTransform>
#include <osgEarth/MapNode>
#include <osgEarthUtil/ObjectLocator>
#include <osgEarthUtil/ObjectPlacer>
#include <osg/Group>
#include <osgEarth/Terrain>
#include <glibmm.h>
#include <osgUtil/LineSegmentIntersector>
#include <osgGA/GUIEventHandler>
class airCraft
{
public:
	airCraft(osg::ref_ptr<osgEarth::MapNode> mapnode,osg::ref_ptr<osg::Group>  root,osg::Vec3d & d3d,double  direction,double ancle);
	bool  AirCraftHeart();

	~airCraft(void);
	osg::ref_ptr<osg::Node>	getNode();
	void  addEventHandle() {aircraft.get()->addEventCallback(new EN());}

private:
	class EN:public osgGA::GUIEventHandler 
	{
	public:
		bool handle(const osgGA::GUIEventAdapter& ea ,osgGA::GUIActionAdapter& us) 
		{

			if (ea.getEventType() == osgGA::GUIEventAdapter::MOVE)
			{

				OE_INFO  <<  "err" << std::endl;
			
			}
			return false;
		}
		void  accept(osgGA::GUIEventHandlerVisitor& v)
		{

			v.visit(*this);
		}
	protected:
	private:
	};
	osg::ref_ptr<osg::PositionAttitudeTransform >  pos;

	osg::Vec3d  target;
	sigc::connection d_connection;
	osg::ref_ptr<osg::Node>  aircraft ;
	osg::ref_ptr<osg::Group> root;
	osg::ref_ptr<osgEarth::MapNode> mapnode;

	osg::ref_ptr<osgEarth::Util::ObjectLocator> locator;
	osg::ref_ptr<osgEarth::Util::ObjectLocatorNode> oln ;
	osg::Quat x;
};
